package com.sphd.beautysalon.presenter;


import com.android.volley.VolleyError;
import com.sphd.beautysalon.model.VipAddModelImpl;
import com.sphd.beautysalon.info.RecordTopUpInfo;
import com.sphd.beautysalon.info.TopUpInfo;
import com.sphd.beautysalon.view.VipAddView;

import java.util.List;

/**
 * Created by Hu on 2016/12/07
 */

public class VipAddPresenterImpl implements VipAddPresenter {
    VipAddModelImpl vipAddModel;
    VipAddView vipAddView;
    int add_money;
    public VipAddPresenterImpl(VipAddView vipAddView) {
        this.vipAddView = vipAddView;
        vipAddModel=new VipAddModelImpl();
    }

    @Override
    public void addData(String url) {
        vipAddView.showLoading();
        vipAddModel.sendUrl(url,this);
    }

    @Override
    public void sendError(VolleyError error) {
        vipAddView.dissLoading();
    }

    @Override
    public void sendList(List<TopUpInfo> topUpInfos) {
        vipAddView.recList(topUpInfos);
        vipAddView.dissLoading();
    }

    @Override
    public void topup(String s, int add_money) {
        this.add_money=add_money;
        vipAddView.showLoading();
        vipAddModel.topuu(s,this);
    }

    @Override
    public void sendRes(int res) {
        vipAddView.recRes(res,add_money);
        vipAddView.dissLoading();
    }

    @Override
    public void getRecodList(String s) {
        vipAddView.showLoading();
        vipAddModel.sendRecodUrl(s,this);
    }

    @Override
    public void sendResList(double account, List<RecordTopUpInfo> recordTopUpInfos) {
        vipAddView.recResList(account,recordTopUpInfos);
        vipAddView.dissLoading();
    }
}